package java5.list;

import com.alibaba.fastjson.JSON;
import org.junit.Test;

import java.util.ArrayList;
import java.util.List;

public class Demo {

    @Test
    public void demo1(){

        List<String> list=new ArrayList<>();

        list.add("哈哈");


        System.out.println(list);

    }


    @Test
    public void demo2(){

        List<String> list=new ArrayList<>();

        list.add("哈哈");


        System.out.println(JSON.toJSONString(null));

    }
    @Test
    public void demo3(){

        StringBuilder sbSql = new StringBuilder();


            sbSql.append("select classid as industryClassId,idcount as count from ( "
                    + "(select l.defaultarea as classid, count(*) as idcount "
                    + "from con_t_basebook b, con_t_book_in_category r, con_t_bookclass l ");

        sbSql.append("where r.bookid = b.bookid ");

        sbSql.append("and b.bookclassid = l.bookclassid ");



        sbSql.append(" and b.isfinish = :isFinished ");

        sbSql.append(" and b.status = :bookStatus ");
        sbSql.append(" and r.displayflag = :displayFlag ");
        sbSql.append(" and r.status = :bookInCategoryStatus ");


        sbSql.append(" and r.categoryid = :categoryId");

        sbSql.append(") union all (");

        sbSql.append("select l.unitearea as classid, count(*) as idcount from con_t_basebook b, con_t_book_in_category r, con_t_bookclass l ");


        sbSql.append("where r.bookid = b.bookid ");

        sbSql.append("and b.bookclassid = l.bookclassid ");



            sbSql.append(" and b.booktype in (:bookTypeList) ");


            sbSql.append(" and b.isfinish = :isFinished ");

        sbSql.append(" and b.status = :bookStatus ");
        sbSql.append(" and r.displayflag = :displayFlag ");
        sbSql.append(" and r.status = :bookInCategoryStatus ");

            sbSql.append(" and r.categoryid = :categoryId");

        sbSql.append(" "
                + ")"
                + ") order by idcount DESC,classid DESC");


        System.out.println(sbSql);





    }
}
